//
//  DownLoadModel.m
//  HuLaQuan
//
//  Created by liyan on 16/1/21.
//  Copyright © 2016年 yuwubao. All rights reserved.
//

#import "DownLoadModel.h"

@interface DownLoadModel()

@property(nonatomic,readwrite)NSString *downloadImage;
@property(nonatomic,readwrite)NSString *downloadTitle;
@property (nonatomic, readwrite) NSString *downloadContent;
@property (nonatomic, readwrite) NSString *downloadTime;
@property(nonatomic,readwrite)NSString *downloadFileID;

@end

@implementation DownLoadModel

-(instancetype)initWithDictionary:(NSDictionary*) dicObject
{
    if((self = [super init]))
    {
        
        [self initValuesWithDictionary:dicObject];
    }
    return self;
}
-(void)initValuesWithDictionary:(NSDictionary*) dicObject
{
    
    [self setValuesForKeysWithDictionary:dicObject];
}
/**
 *  Factory Method
 *
 *  @param dicObject : dictionary of user info including user name and user id
 *
 *  @return Person Object
 */
+(DownLoadModel *)createUserWithUserInfoDictionary:(NSDictionary*)dicObject
{
    return [[DownLoadModel alloc] initWithDictionary:dicObject];
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
    NSLog(@"%@",key);
    if([key isEqualToString:@"broadcastTitle"])
    {
        //
        self.downloadTitle = value;
        // return;
    }
    
    else if([key isEqualToString:@"creadTime"])
    {
        self.downloadTime = value;
        // return;
    }
    else if([key isEqualToString:@"broadcastThumb"])
    {
        self.downloadImage = value;
        // return;
    }
    else if([key isEqualToString:@"broadcastContent"])
    {
        self.downloadContent = value;
        // return;
    }
    else if([key isEqualToString:@"soundFileID"])
    {
        self.downloadFileID = value;
        // return;
    }
    else
    {
        //return;
        [super setValue:value forUndefinedKey:key];
    }
    
}
- (NSString *)description{
    
    return [NSString stringWithFormat:@"title: %@, time: %@, image: %@, content: %@, soundFileID: %@",self.downloadTitle,self.downloadTime,self.downloadImage,self.downloadContent,self.downloadFileID];
}
@end
